/**
 * @(#)TestUserServiceImpl.java 2009-11-16
 *   
 * Copyright  (c) 2009-2010 Wilmar IT Service,  Inc.   
 * All  rights  reserved.   
 * TODO
 */

package test.service.process;

import java.util.HashSet;
import java.util.Set;

import com.wilmar.process.core.services.spi.IUserService;
import com.wilmar.process.entity.Organization;
import com.wilmar.process.entity.Role;
import com.wilmar.process.entity.User;
import com.wilmar.process.exception.DirtyDataException;

/**
 * @author makubex Email:makubexnet@gmail.com
 * @version 1.0.0
 */
public class SimpleUserServiceImpl implements IUserService {

	/**
	 * 
	 * @see com.wilmar.process.core.services.api.IUserService#getDetailUserByUserno
	 *      (java.lang.String, java.lang.String)
	 */

	public User getDetailUserByUserno(String userno, String outSystem) {
		User u = null;
		try {
			u = new User("wsp-user-ua");
			if (userno.equalsIgnoreCase("ua")) {
				u.setEmail("makubexnet@gmail.com");
				u.setName("makubex");
			} else {
				u.setEmail("zhoulibo@wcs-global.com");
				u.setName("zhoulibo");
			}
		} catch (DirtyDataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return u;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.wilmar.process.core.services.api.IUserService#
	 * getListAllUsersByOrganization(com.wilmar.process.entity.Organization,
	 * java.lang.String)
	 */

	public Set<User> getListAllUsersByOrganization(Organization organization,
			String outSystem) {
		Set<User> set = new HashSet<User>();
		try {
			User u = new User("wsp-user-ua");
			u.setEmail("makubexnet@gmail.com");
			u.setName("makubex");
			set.add(u);
		} catch (DirtyDataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return set;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.wilmar.process.core.services.api.IUserService#
	 * getListAllUsersByOrganizationAndRole
	 * (com.wilmar.process.entity.Organization, com.wilmar.process.entity.Role,
	 * java.lang.String)
	 */

	public Set<User> getListAllUsersByOrganizationAndRole(
			Organization organization, Role role, String outSystem) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.wilmar.process.core.services.api.IUserService#getListUsersByOrganization
	 * (com.wilmar.process.entity.Organization, java.lang.String)
	 */

	public Set<User> getListUsersByOrganization(Organization organization,
			String outSystem) {
		Set<User> set = new HashSet<User>();
		try {
			User u = new User("wsp-user-ua");
			u.setEmail("makubexnet@gmail.com");
			u.setName("makubex");
			set.add(u);
		} catch (DirtyDataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return set;
	}

	/**
	 * @see com.wilmar.process.core.services.spi.IUserService#getListUsersByOrganizationAndRole(com.wilmar.process.entity.Organization,
	 *      com.wilmar.process.entity.Role, java.lang.String)
	 */
	public Set<User> getListUsersByOrganizationAndRole(
			Organization organization, Role role, String outSystem) {
		Set<User> set = new HashSet<User>();
		try {
			set.add(new User("wsp-user-ua"));
		} catch (DirtyDataException e) {
			e.printStackTrace();
		}
		return set;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.wilmar.process.core.services.api.IUserService#getListUsersByRole(
	 * com.wilmar.process.entity.Role, java.lang.String)
	 */

	public Set<User> getListUsersByRole(Role role, String outSystem) {
		Set<User> set = new HashSet<User>();
		try {
			User u = new User("wsp-user-ua");
			u.setEmail("makubexnet@gmail.com");
			u.setName("makubex");
			set.add(u);
		} catch (DirtyDataException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return set;
	}

}
